package com.lwh.springboot.controller;

import com.lwh.springboot.pojo.entity.Car;
import com.lwh.springboot.service.ICarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class IndexController {
    @Autowired
    private ICarService carService;

    @RequestMapping("/")
    public String index(Model model) {
        List<Car> list = carService.selectAll();
        model.addAttribute("list", list);
        return "index";
    }
}
